<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmAsignarAreas.aspx.vb" Inherits="frmAsignaIndicador" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Asignar Area a Usuario - PANEL WEB GCOL</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <br />
        <br />
        <asp:Label ID="Label2" runat="server" Height="22px" Text="Area" Width="81px"></asp:Label>&nbsp;<asp:DropDownList
            ID="lstInd" runat="server" AppendDataBoundItems="True" DataSourceID="DataAreas"
            DataTextField="descripcion" DataValueField="id_area" Width="535px" AutoPostBack="True">
            <asp:ListItem Selected="True" Value="0">Seleccione Area</asp:ListItem>
        </asp:DropDownList><br />
        <br />
        <asp:Label ID="Label1" runat="server" Height="22px" Text="Seleccionar Usuario" Visible="False"
            Width="135px"></asp:Label>&nbsp;<asp:DropDownList ID="lstUsuario" runat="server"
                DataSourceID="DataUsuarios" DataTextField="persona" DataValueField="usuario"
                Visible="False" Width="177px">
            </asp:DropDownList>
        <asp:Button ID="btnAsignar" runat="server" Text="Asignar" Visible="False" /><br />
        <br />
        &nbsp;
        <br />
        <table style="width: 500px; height: 94px">
            <tr>
                <td style="width: 150px">
                    <asp:Label ID="lblAct" runat="server" Text="Asignados" Visible="False"></asp:Label></td>
                <td style="width: 102px">
                    &nbsp; &nbsp; &nbsp;&nbsp;</td>
            </tr>
            <tr>
                <td style="width: 150px">
                    <asp:ListBox ID="lstAsignados" runat="server" DataSourceID="UsuariosAreas" DataTextField="nombre"
                        DataValueField="usuario" Height="120px" Visible="False" Width="220px"></asp:ListBox></td>
                <td style="width: 105px">
                    &nbsp;&nbsp;
                    <asp:Button ID="btnEliminar" runat="server" Style="position: static" Text="Eliminar"
                        Visible="False" Width="69px" /><br />
                    <br />
                    &nbsp;
                </td>
            </tr>
        </table>
        <br />
        <br />
        <asp:HyperLink ID="lnkVolver" runat="server" NavigateUrl="~/frmPaneldeControl.aspx">Volver al Menu</asp:HyperLink><br />
        <asp:SqlDataSource ID="DataUsuarios" runat="server" ConnectionString="<%$ ConnectionStrings:CnxApp %>"
            SelectCommand="select usuario, nombre+' '+ apellido as persona from usuario&#13;&#10;where usuario not in (select usuario from asigna_indicador where id_ind = @x and activo = 1 or activo = 0)&#13;&#10;order by persona">
            <SelectParameters>
                <asp:ControlParameter ControlID="lstInd" Name="x" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="DataAreas" runat="server" ConnectionString="<%$ ConnectionStrings:CnxApp %>"
            SelectCommand="SELECT [id_area], replace([descripcion],'%25','%') as descripcion FROM [Area]&#13;&#10;order by descripcion"></asp:SqlDataSource>
        <asp:SqlDataSource ID="UsuariosAreas" runat="server" ConnectionString="<%$ ConnectionStrings:CnxApp %>"
            SelectCommand="select a.usuario, b.nombre+' '+b.apellido as nombre from UsuarioArea a , usuario b where id_area =@x and a.usuario = b.usuario">
            <SelectParameters>
                <asp:ControlParameter ControlID="lstInd" Name="x" PropertyName="SelectedValue" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
    </form>
</body>
</html>
